Skip to content

Add missing networking runtime configuration switches#52297

Open
Copilot wants to merge 6 commits intomainfrom
copilot/add-missing-networking-switches
Open

Add missing networking runtime configuration switches#52297
Copilot wants to merge 6 commits intomainfrom
copilot/add-missing-networking-switches

Conversation

Copy link
Contributor

Copilot AI commented Mar 13, 2026

The networking runtime config page (docs/core/runtime-config/networking.md) only documented two settings despite many more being configurable. This adds the missing switches, verified against the dotnet/runtime source.

Added sections

Section Setting name Notes
HTTP/3 protocol System.Net.SocketsHttpHandler.Http3Support Enabled by default starting in .NET 7
HTTP/2 dynamic window scaling System.Net.SocketsHttpHandler.Http2FlowControl.DisableDynamicWindowSizing true disables the algorithm; enabled by default
HTTP/2 stream receive window size DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_FLOWCONTROL_MAXSTREAMWINDOWSIZE Env var only; default 16 MB, min 65,535
HTTP/2 stream window scale threshold DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_FLOWCONTROL_STREAMWINDOWSCALETHRESHOLDMULTIPLIER Env var only; default 1.0
HTTP activity propagation System.Net.Http.EnableActivityPropagation Distributed tracing (traceparent) for OpenTelemetry; enabled by default
Pending connection timeout on request completion System.Net.SocketsHttpHandler.PendingConnectionTimeoutOnRequestCompletion Default 5,000 ms
Proxy pre-authentication System.Net.Http.SocketsHttpHandler.ProxyPreAuthenticate Disabled by default
Maximum connections per server System.Net.SocketsHttpHandler.MaxConnectionsPerServer Default unlimited
Socket inline completions DOTNET_SYSTEM_NET_SOCKETS_INLINE_COMPLETIONS Env var only; disabled by default
Socket thread count DOTNET_SYSTEM_NET_SOCKETS_THREAD_COUNT Env var only
IPv6 System.Net.DisableIPv6
TLS session resumption System.Net.Security.DisableTlsResume Enabled by default
Server AIA downloads System.Net.Security.EnableServerAiaDownloads Disabled by default
QUIC configuration caching System.Net.Quic.DisableConfigurationCache Caching enabled by default
App-local MsQuic System.Net.Quic.AppLocalMsQuic Windows only; AppContext only
HttpListener kernel response buffering System.Net.HttpListener.EnableKernelResponseBuffering Windows only; AppContext only; disabled by default

Accuracy notes

  • The HTTP/2 stream receive window size and scale threshold are env-var only — the runtime uses ParseInt32/DoubleEnvironmentVariableValue rather than QueryRuntimeSettingSwitch, so no runtimeconfig.json key exists for these.
  • The DisableDynamicWindowSizing flag defaults to false (algorithm enabled). Setting to true disables it.
  • The UseSocketsHttpHandler setting was deliberately excluded as it was previously removed from the docs (see Remove/update version 3.1 usage #40601) since it's no longer available in .NET 5+.
  • The App-local MsQuic and HttpListener kernel response buffering settings are AppContext-only (no environment variable equivalent).
  • TLS and QUIC switches verified against SslStream.Protocol.cs, MsQuicApi.cs, MsQuicConfiguration.Cache.cs, and HttpListener.Windows.cs in the dotnet/runtime source.
Original prompt

This section details on the original issue you should resolve

<issue_title>Add missing networking switches</issue_title>
<issue_description>


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Comments on the Issue (you are @copilot in this section)

@gewarren Page views are low-ish. Lowering the priority on this.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


Internal previews

📄 File 🔗 Preview link
docs/core/runtime-config/networking.md docs/core/runtime-config/networking

Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
Copilot AI changed the title [WIP] Add missing networking switches Add missing networking runtime configuration switches Mar 13, 2026
Copilot AI requested a review from BillWagner March 13, 2026 17:25
@gewarren gewarren requested a review from a team March 13, 2026 18:38
@rzikm
Copy link
Member

rzikm commented Mar 16, 2026

There are more network switches (added since the issue was filed probably), The non-HTTP ones should be visible in dotnet/runtime#125385 (that PR only moves the definition, does not add/remove)

Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
… remove UseSocketsHttpHandler section

Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
Copilot AI requested a review from BillWagner March 16, 2026 14:09
@BillWagner
Copy link
Member

@copilot Address this comment: #52297 (comment) by adding the additional switches.

@BillWagner
Copy link
Member

@rzikm @gewarren

The additions show the default and some minimum allowed values. Should all the integer and float values include a valid range, the max as well as the min?

…nd HttpListener

Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 16, 2026

@copilot Address this comment: #52297 (comment) by adding the additional switches.

Added in c9d8bdb. The new sections cover the additional switches from the runtime source (verified against GlobalHttpSettings.cs, SslStream.Protocol.cs, MsQuicConfiguration.Cache.cs, MsQuicApi.cs, and HttpListener.Windows.cs):

HTTP:

  • Pending connection timeout on request completion (System.Net.SocketsHttpHandler.PendingConnectionTimeoutOnRequestCompletion)
  • Proxy pre-authentication (System.Net.Http.SocketsHttpHandler.ProxyPreAuthenticate)
  • Maximum connections per server (System.Net.SocketsHttpHandler.MaxConnectionsPerServer)

TLS/SSL:

  • TLS session resumption (System.Net.Security.DisableTlsResume / DOTNET_SYSTEM_NET_SECURITY_DISABLETLSRESUME)
  • Server AIA downloads (System.Net.Security.EnableServerAiaDownloads / DOTNET_SYSTEM_NET_SECURITY_ENABLESERVERAIADOWNLOADS)

QUIC:

  • QUIC configuration caching (System.Net.Quic.DisableConfigurationCache / DOTNET_SYSTEM_NET_QUIC_DISABLE_CONFIGURATION_CACHE)
  • App-local MsQuic, Windows only (System.Net.Quic.AppLocalMsQuic, AppContext only)

HttpListener:

  • Kernel response buffering, Windows only (System.Net.HttpListener.EnableKernelResponseBuffering, AppContext only)

@rzikm
Copy link
Member

rzikm commented Mar 16, 2026

@rzikm @gewarren

The additions show the default and some minimum allowed values. Should all the integer and float values include a valid range, the max as well as the min?

@MihaZupan would probably know,

cc @dotnet/ncl

@MihaZupan
Copy link
Member

Looking at the list, that leaves:

  • DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_FLOWCONTROL_MAXSTREAMWINDOWSIZE
    • Already documented as Integer (default: 16 MB; minimum: 65,535)
    • No real max. Increasing it would only be beneficial in a network that's both high throughput and high latency.
  • DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_FLOWCONTROL_STREAMWINDOWSCALETHRESHOLDMULTIPLIER
    • Documented as Float (default: 1.0; minimum: 0)
    • No real max. Increasing it too much would just effectively cap the max throughput of an individual request relative to your network throughput.
    • Feels more like an option exposed for our own testing than for regular users to modify
  • DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_PENDINGCONNECTIONTIMEOUTONREQUESTCOMPLETION
    • Documented as Integer (default: 5000)
    • -1 is a valid minimum value with the meaning of "forever" - it's effectively the max.
    • 0 means "immediately cancel". There's no real max (other than int32), but really high values are pointless in practice.
  • DOTNET_SYSTEM_NET_SOCKETS_THREAD_COUNT
    • Realistic values are [1, ProcessorCount], but we don't always enforce that so if the user hates performance they're free to set it higher :)

@BillWagner
Copy link
Member

@copilot

Make changes based on this comment: #52297 (comment)

Note that for some switches, there is a practical limit and a different allowed limit. Further, note that some of the switches aren't generally used by most developers. Modulate your edits to point distinguish hard limits, practical advice, and note where switches aren't intended for general developer use.

…r guidance

Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 17, 2026

@copilot

Make changes based on this comment: #52297 (comment)
...

Updated in b205a6d based on @MihaZupan's feedback:

  • Stream window scale threshold: Added a note that this is intended for advanced diagnostics/internal tuning and most developers don't need it. Clarified that values much above the default progressively limit per-request throughput.
  • Stream receive window size: Clarified that values below 65,535 are clamped (not rejected), and noted there's no hard upper limit — only beneficial on high-throughput, high-latency networks.
  • Pending connection timeout: Documented the -1 (wait indefinitely) and 0 (cancel immediately) special values explicitly. Noted there's no hard upper limit.
  • Socket thread count: Documented the practical range as [1, ProcessorCount], noted that values outside this range aren't rejected, and added a note that this setting is for extreme load scenarios — most developers don't need it.

Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, and is ready for final review.

@BillWagner BillWagner marked this pull request as ready for review March 17, 2026 18:14
@BillWagner BillWagner requested a review from a team as a code owner March 17, 2026 18:14
Copilot AI review requested due to automatic review settings March 17, 2026 18:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the .NET runtime networking configuration documentation to cover additional runtimeconfig and environment-variable switches that control HTTP, socket, TLS, QUIC, and HttpListener behaviors.

Changes:

  • Adds documentation for missing networking runtime configuration switches (HTTP/3, HTTP/2 flow control, diagnostics propagation, proxy behavior, socket settings, IPv6, TLS, QUIC, and HttpListener).
  • Refreshes article metadata (ms.date) and adds AI usage disclosure (ai-usage).
  • Improves wording in the existing SPN creation section.

Comment on lines +110 to +111
| **runtimeconfig.json** | `System.Net.Http.SocketsHttpHandler.ProxyPreAuthenticate` | `false` - disabled (default)<br>`true` - enabled |
| **Environment variable** | `DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_PROXYPREAUTHENTICATE` | `0` - disabled (default)<br>`1` - enabled |
Comment on lines +25 to +28
| | Setting name | Values |
| - | - | - |
| **runtimeconfig.json** | `System.Net.SocketsHttpHandler.Http3Support` | `false` - disabled <br>`true` - enabled |
| **Environment variable** | `DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_HTTP3SUPPORT` | `0` - disabled<br/>`1` - enabled |
Comment on lines +39 to +40
| **runtimeconfig.json** | `System.Net.Http.UsePortInSpn` | `true` - include port number in SPN, for example, `HTTP/host:port`<br>`false` - don't include port in SPN, for example, `HTTP/host` |
| **Environment variable** | `DOTNET_SYSTEM_NET_HTTP_USEPORTINSPN` | `1` - include port number in SPN, for example, `HTTP/host:port`<br>`0` - don't include port in SPN, for example, `HTTP/host` |

## QUIC configuration caching

Disables caching of MsQuic configuration objects. When enabled (default), the system caches and reuses configuration objects across connections, which reduces the overhead of TLS and QUIC setup for repeated connections with the same parameters.

## TLS session resumption

Disables TLS session resumption for <xref:System.Net.Security.SslStream>. Session resumption allows TLS reconnections to skip a full handshake by reusing previously negotiated session parameters, which reduces latency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add missing networking switches

6 participants